﻿

using Maticsoft.BLL;
using Maticsoft.Model;

using System;
using System.Collections.Generic;
using System.Web.UI.HtmlControls;

public partial class WebPage_Index_Index : BBasepage
{
    protected string[] alipay = new string[7];
    protected string alipaySum = "";
    protected string[] caifutong = new string[7];
    protected string caifutongSum = "";
    protected string[] chinabank = new string[7];
    protected string chinabankSum = "";
    protected string[] color = new string[7];
    protected string[] count = new string[7];
    protected string countSum = "";

    protected string[] guanli = new string[7];
    protected string guanliSum = "";

    protected string[] money = new string[7];
    protected string moneySum = "";
    private Maticsoft.Model.Order order = new Maticsoft.Model.Order();
    protected string[] OrderDay = new string[7];
    protected string[] OrderDay_Pay = new string[7];
    protected string OrderDay_PaySum = "";
    protected string[] OrderDay_UnPay = new string[7];
    protected string OrderDay_UnPaySum = "";
    protected string OrderDaySum = "";
    private Maticsoft.BLL.Order orderlist = new Maticsoft.BLL.Order();
    protected string[] realPay = new string[7];
    protected string realPaySum = "";
    protected string sql = "";
    protected string strEmailTotal = "";
    protected string strOrderTotal = "";
    protected string strTotalTeam = "";
    protected string strUserTotal = "";
    protected string[] tenpay = new string[7];
    protected string tenpaySum = "";
    protected string[] UserDay = new string[7];
    protected string UserDaySum = "";
    protected string[] wangyin = new string[7];
    protected string wangyinSum = "";
    protected string[] yeepay = new string[7];
    protected string yeepaySum = "";
    protected string[] yibao = new string[7];
    protected string yibaoSum = "";
    protected string[] yue = new string[7];
    protected string[] Yue = new string[7];
    protected string yueSum = "";
    protected string YueSum = "";
    protected string[] zhifubao = new string[7];
    protected string zhifubaoSum = "";

    private List<string> getWeek()
    {
        List<string> list = new List<string>();
        switch (DateTime.Today.DayOfWeek.ToString())
        {
            case "Monday":
                list.Clear();
                list.Add(DateTime.Now.ToString("yyyy-M-d"));
                this.color[0] = "style='color:red;'";
                this.color[1] = "";
                this.color[2] = "";
                this.color[3] = "";
                this.color[4] = "";
                this.color[5] = "";
                this.color[6] = "";
                return list;

            case "Tuesday":
                list.Clear();
                list.Add(DateTime.Now.AddDays(-1.0).ToString("yyyy-M-d"));
                list.Add(DateTime.Now.ToString("yyyy-M-d"));
                this.color[0] = "";
                this.color[1] = "style='color:red;'";
                this.color[2] = "";
                this.color[3] = "";
                this.color[4] = "";
                this.color[5] = "";
                this.color[6] = "";
                return list;

            case "Wednesday":
                list.Clear();
                list.Add(DateTime.Now.AddDays(-2.0).ToString("yyyy-M-d"));
                list.Add(DateTime.Now.AddDays(-1.0).ToString("yyyy-M-d"));
                list.Add(DateTime.Now.ToString("yyyy-M-d"));
                this.color[0] = "";
                this.color[1] = "";
                this.color[2] = "style='color:red;'";
                this.color[3] = "";
                this.color[4] = "";
                this.color[5] = "";
                this.color[6] = "";
                return list;

            case "Thursday":
                list.Clear();
                list.Add(DateTime.Now.AddDays(-3.0).ToString("yyyy-M-d"));
                list.Add(DateTime.Now.AddDays(-2.0).ToString("yyyy-M-d"));
                list.Add(DateTime.Now.AddDays(-1.0).ToString("yyyy-M-d"));
                list.Add(DateTime.Now.ToString("yyyy-M-d"));
                this.color[0] = "";
                this.color[1] = "";
                this.color[2] = "";
                this.color[3] = "style='color:red;'";
                this.color[4] = "";
                this.color[5] = "";
                this.color[6] = "";
                return list;

            case "Friday":
                list.Clear();
                list.Add(DateTime.Now.AddDays(-4.0).ToString("yyyy-M-d"));
                list.Add(DateTime.Now.AddDays(-3.0).ToString("yyyy-M-d"));
                list.Add(DateTime.Now.AddDays(-2.0).ToString("yyyy-M-d"));
                list.Add(DateTime.Now.AddDays(-1.0).ToString("yyyy-M-d"));
                list.Add(DateTime.Now.ToString("yyyy-M-d"));
                this.color[0] = "";
                this.color[1] = "";
                this.color[2] = "";
                this.color[3] = "";
                this.color[4] = "style='color:red;'";
                this.color[5] = "";
                this.color[6] = "";
                return list;

            case "Saturday":
                list.Clear();
                list.Add(DateTime.Now.AddDays(-5.0).ToString("yyyy-M-d"));
                list.Add(DateTime.Now.AddDays(-4.0).ToString("yyyy-M-d"));
                list.Add(DateTime.Now.AddDays(-3.0).ToString("yyyy-M-d"));
                list.Add(DateTime.Now.AddDays(-2.0).ToString("yyyy-M-d"));
                list.Add(DateTime.Now.AddDays(-1.0).ToString("yyyy-M-d"));
                list.Add(DateTime.Now.ToString("yyyy-M-d"));
                this.color[0] = "";
                this.color[1] = "";
                this.color[2] = "";
                this.color[3] = "";
                this.color[4] = "";
                this.color[5] = "style='color:red;'";
                this.color[6] = "";
                return list;

            case "Sunday":
                list.Clear();
                list.Add(DateTime.Now.AddDays(-6.0).ToString("yyyy-M-d"));
                list.Add(DateTime.Now.AddDays(-5.0).ToString("yyyy-M-d"));
                list.Add(DateTime.Now.AddDays(-4.0).ToString("yyyy-M-d"));
                list.Add(DateTime.Now.AddDays(-3.0).ToString("yyyy-M-d"));
                list.Add(DateTime.Now.AddDays(-2.0).ToString("yyyy-M-d"));
                list.Add(DateTime.Now.AddDays(-1.0).ToString("yyyy-M-d"));
                list.Add(DateTime.Now.ToString("yyyy-M-d"));
                this.color[0] = "";
                this.color[1] = "";
                this.color[2] = "";
                this.color[3] = "";
                this.color[4] = "";
                this.color[5] = "";
                this.color[6] = "style='color:red;'";
                break;
        }
        return list;
    }

    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        this.HeaderControl1.Select = "index";
        if (!base.IsPostBack)
        {
            this.setValue();
        }
    }

    private void setValue()
    {
        int num = 0;
        int num2 = 0;
        int num3 = 0;
        int num4 = 0;
        int num5 = 0;
        decimal num6 = 0M;
        decimal num7 = 0M;
        decimal num8 = 0M;
        decimal num9 = 0M;
        decimal num10 = 0M;
        decimal num11 = 0M;
        decimal num12 = 0M;
        decimal num13 = 0M;
        int num14 = 0;
        int num15 = 0;
        int num16 = 0;
        int num17 = 0;
        int num18 = 0;
        int index = 0;
        List<string> list = this.getWeek();
        string str = list[0];
        string str2 = list[list.Count - 1];
        foreach (string str3 in list)
        {
            string service;
            string str4 = "Create_time BETWEEN '" + str3 + " 00:00:00' and '" + str3 + " 23:59:59'";
            string str5 = "pay_time between '" + str3 + " 00:00:00' and '" + str3 + " 23:59:59'";
            string strWhere = "((Create_time BETWEEN '" + str3 + " 00:00:00' and '" + str3 + " 23:59:59') or(pay_time between '" + str3 + " 00:00:00' and '" + str3 + " 23:59:59'))";
            int num20 = 0;
            decimal num21 = 0M;
            decimal num22 = 0M;
            decimal num23 = 0M;
            decimal num24 = 0M;
            decimal num25 = 0M;
            decimal num26 = 0M;
            decimal num27 = 0M;
            decimal num28 = 0M;
            int num29 = 0;
            int num30 = 0;
            int num31 = 0;
            int num32 = 0;
            int num33 = 0;
            foreach (Maticsoft.Model.Order order in this.orderlist.GetModelList(str5 + " and State='pay'"))
            {
                service = order.Service.ToLower();
                if (service != null)
                {
                    if (!(service == "alipay"))
                    {
                        if (service == "yeepay")
                        {
                            goto Label_0251;
                        }
                        if (service == "tenpay")
                        {
                            goto Label_0263;
                        }
                        if (service == "chinabank")
                        {
                            goto Label_0275;
                        }
                        if (service == "cash")
                        {
                            goto Label_0287;
                        }
                    }
                    else
                    {
                        num23 += order.Money;
                    }
                }
                goto Label_0299;
            Label_0251:
                num24 += order.Money;
                goto Label_0299;
            Label_0263:
                num25 += order.Money;
                goto Label_0299;
            Label_0275:
                num26 += order.Money;
                goto Label_0299;
            Label_0287:
                num27 += order.Origin;
            Label_0299:
                if ((order.Service != "cash") && (order.Service != "credit"))
                {
                    num28 += order.Money;
                }
                num20 += order.Quantity;
                num22 += order.Credit;
                num21 += order.Origin;
            }
            int num34 = int.Parse(base.GetCount("count(*)", "Create_time BETWEEN '" + str3 + " 00:00:00' AND '" + str3 + " 23:59:59'", "User"));
            this.UserDay[index] = num34 + "个";
            num15 += num34;
            int num35 = int.Parse(base.GetCount("count(*)", strWhere, "Order"));
            this.OrderDay[index] = num35 + "单";
            num16 += num35;
            int num36 = Convert.ToInt32(base.GetCount("count(*)", str4 + " and State='unpay'", "Order"));
            int num37 = Convert.ToInt32(base.GetCount("count(*)", str5 + " and State='pay'", "Order"));
            if (num36 > 0)
            {
                this.OrderDay_UnPay[index] = string.Concat(new object[] { "<a href='Dingdan_Unpay.aspx?time=", str3, "&state=unpay' target='_blank'>", num36, "单</a>" });
            }
            else
            {
                this.OrderDay_UnPay[index] = num36 + "单";
            }
            if (num37 > 0)
            {
                this.OrderDay_Pay[index] = string.Concat(new object[] { "<a href='Dingdan_Pay.aspx?time=", str3, "&state=pay' target='_blank'>", num37, "单</a>" });
            }
            else
            {
                this.OrderDay_Pay[index] = num37 + "单";
            }
            foreach (Maticsoft.Model.Order order in this.orderlist.GetModelList(str5 + " and State='pay' "))
            {
                service = order.Service;
                if (service != null)
                {
                    if (!(service == "yeepay"))
                    {
                        if (service == "alipay")
                        {
                            goto Label_0587;
                        }
                        if (service == "tenpay")
                        {
                            goto Label_058F;
                        }
                        if (service == "chinabank")
                        {
                            goto Label_0597;
                        }
                        if (service == "credit")
                        {
                            goto Label_059F;
                        }
                    }
                    else
                    {
                        num29++;
                    }
                }
                goto Label_05A9;
            Label_0587:
                num30++;
                goto Label_05A9;
            Label_058F:
                num31++;
                goto Label_05A9;
            Label_0597:
                num32++;
                goto Label_05A9;
            Label_059F:
                num33++;
            Label_05A9:;
            }
            if (num29 > 0)
            {
                this.yibao[index] = string.Concat(new object[] { "<a href='Dingdan_Service.aspx?service=yeepay&time=", str3, "' target='_blank'>", num29, "单</a>" });
            }
            else
            {
                this.yibao[index] = num29 + "单";
            }
            if (num30 > 0)
            {
                this.zhifubao[index] = string.Concat(new object[] { "<a href='Dingdan_Service.aspx?service=alipay&time=", str3, "' target='_blank'>", num30, "单</a>" });
            }
            else
            {
                this.zhifubao[index] = num30 + "单";
            }
            if (num31 > 0)
            {
                this.caifutong[index] = string.Concat(new object[] { "<a href='Dingdan_Service.aspx?service=tenpay&time=", str3, "' target='_blank'>", num31, "单</a>" });
            }
            else
            {
                this.caifutong[index] = num31 + "单";
            }
            if (num32 > 0)
            {
                this.wangyin[index] = string.Concat(new object[] { "<a href='Dingdan_Service.aspx?service=chinabank&time=", str3, "' target='_blank'>", num32, "单</a>" });
            }
            else
            {
                this.wangyin[index] = num32 + "单";
            }
            if (num33 > 0)
            {
                this.yue[index] = string.Concat(new object[] { "<a href='Dingdan_Service.aspx?service=credit&time=", str3, "' target='_blank'>", num33, "单</a>" });
            }
            else
            {
                this.yue[index] = num33 + "单";
            }
            num17 += num36;
            num18 += num37;
            num5 += num29;
            num2 += num30;
            num3 += num31;
            num4 += num32;
            num += num33;
            this.yeepay[index] = num24 + "元";
            num7 += num24;
            this.Yue[index] = num22 + "元";
            num11 += num22;
            this.alipay[index] = num23 + "元";
            num8 += num23;
            this.tenpay[index] = num25 + "元";
            num9 += num25;
            this.chinabank[index] = num26 + "元";
            num10 += num26;
            this.guanli[index] = num27 + "元";
            num13 += num27;
            this.money[index] = num21 + "元";
            num12 += num21;
            this.count[index] = num20 + "个";
            num14 += num20;
            this.realPay[index] = num28 + "元";
            num6 += num28;
            index++;
        }
        this.UserDaySum = num15 + "个";
        this.OrderDaySum = num16 + "单";
        this.OrderDay_UnPaySum = num17 + "单";
        this.OrderDay_PaySum = num18 + "单";
        this.countSum = num14 + "个";
        this.moneySum = num12 + "元";
        this.YueSum = num11 + "元";
        this.alipaySum = num8 + "元";
        this.yeepaySum = num7 + "元";
        this.tenpaySum = num9 + "元";
        this.chinabankSum = num10 + "元";
        this.guanliSum = num13 + "元";
        this.realPaySum = num6 + "元";
        this.yibaoSum = num5 + "单";
        this.zhifubaoSum = num2 + "单";
        this.caifutongSum = num3 + "单";
        this.wangyinSum = num4 + "单";
        this.yueSum = num + "单";
        this.strTotalTeam = base.GetCount("count(*)", "", "Team");
        this.strUserTotal = base.GetCount("count(*)", "", "User");
        this.strOrderTotal = base.GetCount("count(*)", "", "Order");
        this.strEmailTotal = base.GetCount("count(*)", "", "Mailer");
    }
}


